\(\int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^4 \, dx\) [666]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 39, antiderivative size = 59 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^4 \, dx=\frac {a (i A+B) c^4 (1-i \tan (e+f x))^4}{4 f}-\frac {a B c^4 (1-i \tan (e+f x))^5}{5 f} \]

[Out]

1/4*a*(I*A+B)*c^4*(1-I*tan(f*x+e))^4/f-1/5*a*B*c^4*(1-I*tan(f*x+e))^5/f

Rubi [A] (verified)

Time = 0.09 (sec) , antiderivative size = 59, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.051, Rules used = {3669, 45} \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^4 \, dx=\frac {a c^4 (B+i A) (1-i \tan (e+f x))^4}{4 f}-\frac {a B c^4 (1-i \tan (e+f x))^5}{5 f} \]

[In]

Int[(a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^4,x]

[Out]

(a*(I*A + B)*c^4*(1 - I*Tan[e + f*x])^4)/(4*f) - (a*B*c^4*(1 - I*Tan[e + f*x])^5)/(5*f)

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 3669

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a*(c/f), Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {(a c) \text {Subst}\left (\int (A+B x) (c-i c x)^3 \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {(a c) \text {Subst}\left (\int \left ((A-i B) (c-i c x)^3+\frac {i B (c-i c x)^4}{c}\right ) \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {a (i A+B) c^4 (1-i \tan (e+f x))^4}{4 f}-\frac {a B c^4 (1-i \tan (e+f x))^5}{5 f} \\ \end{align*}

Mathematica [A] (verified)

Time = 1.45 (sec) , antiderivative size = 77, normalized size of antiderivative = 1.31 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^4 \, dx=\frac {i a c^4 \left (B (i+\tan (e+f x))^5+\frac {5}{4} (A-i B) \tan (e+f x) \left (-4 i-6 \tan (e+f x)+4 i \tan ^2(e+f x)+\tan ^3(e+f x)\right )\right )}{5 f} \]

[In]

Integrate[(a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^4,x]

[Out]

((I/5)*a*c^4*(B*(I + Tan[e + f*x])^5 + (5*(A - I*B)*Tan[e + f*x]*(-4*I - 6*Tan[e + f*x] + (4*I)*Tan[e + f*x]^2
 + Tan[e + f*x]^3))/4))/f

Maple [A] (verified)

Time = 0.18 (sec) , antiderivative size = 56, normalized size of antiderivative = 0.95

method result size
risch \(\frac {4 a \,c^{4} \left (5 i A \,{\mathrm e}^{2 i \left (f x +e \right )}+5 B \,{\mathrm e}^{2 i \left (f x +e \right )}+5 i A -3 B \right )}{5 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{5}}\) \(56\)
derivativedivides \(\frac {i a \,c^{4} \left (\frac {B \tan \left (f x +e \right )^{5}}{5}+\frac {\left (3 i B +A \right ) \tan \left (f x +e \right )^{4}}{4}+\frac {\left (3 i A -3 B \right ) \tan \left (f x +e \right )^{3}}{3}+\frac {\left (-i B -3 A \right ) \tan \left (f x +e \right )^{2}}{2}-i \tan \left (f x +e \right ) A \right )}{f}\) \(85\)
default \(\frac {i a \,c^{4} \left (\frac {B \tan \left (f x +e \right )^{5}}{5}+\frac {\left (3 i B +A \right ) \tan \left (f x +e \right )^{4}}{4}+\frac {\left (3 i A -3 B \right ) \tan \left (f x +e \right )^{3}}{3}+\frac {\left (-i B -3 A \right ) \tan \left (f x +e \right )^{2}}{2}-i \tan \left (f x +e \right ) A \right )}{f}\) \(85\)
norman \(\frac {A a \,c^{4} \tan \left (f x +e \right )}{f}-\frac {\left (-i A a \,c^{4}+3 B a \,c^{4}\right ) \tan \left (f x +e \right )^{4}}{4 f}+\frac {\left (-3 i A a \,c^{4}+B a \,c^{4}\right ) \tan \left (f x +e \right )^{2}}{2 f}-\frac {\left (i B a \,c^{4}+A a \,c^{4}\right ) \tan \left (f x +e \right )^{3}}{f}+\frac {i B a \,c^{4} \tan \left (f x +e \right )^{5}}{5 f}\) \(121\)
parallelrisch \(\frac {4 i B a \,c^{4} \tan \left (f x +e \right )^{5}+5 i A \tan \left (f x +e \right )^{4} a \,c^{4}-20 i B \tan \left (f x +e \right )^{3} a \,c^{4}-15 B \tan \left (f x +e \right )^{4} a \,c^{4}-30 i A \tan \left (f x +e \right )^{2} a \,c^{4}-20 A \tan \left (f x +e \right )^{3} a \,c^{4}+10 B \tan \left (f x +e \right )^{2} a \,c^{4}+20 A \tan \left (f x +e \right ) a \,c^{4}}{20 f}\) \(129\)
parts \(\frac {\left (-3 i A a \,c^{4}+B a \,c^{4}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}+\frac {\left (-3 i B a \,c^{4}-2 A a \,c^{4}\right ) \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {\left (-2 i A a \,c^{4}-2 B a \,c^{4}\right ) \left (\frac {\tan \left (f x +e \right )^{2}}{2}-\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}\right )}{f}+\frac {\left (-2 i B a \,c^{4}-3 A a \,c^{4}\right ) \left (\frac {\tan \left (f x +e \right )^{3}}{3}-\tan \left (f x +e \right )+\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {\left (i A a \,c^{4}-3 B a \,c^{4}\right ) \left (\frac {\tan \left (f x +e \right )^{4}}{4}-\frac {\tan \left (f x +e \right )^{2}}{2}+\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}\right )}{f}+A a \,c^{4} x +\frac {i B a \,c^{4} \left (\frac {\tan \left (f x +e \right )^{5}}{5}-\frac {\tan \left (f x +e \right )^{3}}{3}+\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(267\)

[In]

int((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^4,x,method=_RETURNVERBOSE)

[Out]

4/5*a*c^4*(5*I*A*exp(2*I*(f*x+e))+5*B*exp(2*I*(f*x+e))+5*I*A-3*B)/f/(exp(2*I*(f*x+e))+1)^5

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 100 vs. \(2 (49) = 98\).

Time = 0.24 (sec) , antiderivative size = 100, normalized size of antiderivative = 1.69 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^4 \, dx=-\frac {4 \, {\left (5 \, {\left (-i \, A - B\right )} a c^{4} e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (-5 i \, A + 3 \, B\right )} a c^{4}\right )}}{5 \, {\left (f e^{\left (10 i \, f x + 10 i \, e\right )} + 5 \, f e^{\left (8 i \, f x + 8 i \, e\right )} + 10 \, f e^{\left (6 i \, f x + 6 i \, e\right )} + 10 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 5 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \]

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^4,x, algorithm="fricas")

[Out]

-4/5*(5*(-I*A - B)*a*c^4*e^(2*I*f*x + 2*I*e) + (-5*I*A + 3*B)*a*c^4)/(f*e^(10*I*f*x + 10*I*e) + 5*f*e^(8*I*f*x
 + 8*I*e) + 10*f*e^(6*I*f*x + 6*I*e) + 10*f*e^(4*I*f*x + 4*I*e) + 5*f*e^(2*I*f*x + 2*I*e) + f)

Sympy [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 155 vs. \(2 (46) = 92\).

Time = 0.31 (sec) , antiderivative size = 155, normalized size of antiderivative = 2.63 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^4 \, dx=\frac {20 i A a c^{4} - 12 B a c^{4} + \left (20 i A a c^{4} e^{2 i e} + 20 B a c^{4} e^{2 i e}\right ) e^{2 i f x}}{5 f e^{10 i e} e^{10 i f x} + 25 f e^{8 i e} e^{8 i f x} + 50 f e^{6 i e} e^{6 i f x} + 50 f e^{4 i e} e^{4 i f x} + 25 f e^{2 i e} e^{2 i f x} + 5 f} \]

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))**4,x)

[Out]

(20*I*A*a*c**4 - 12*B*a*c**4 + (20*I*A*a*c**4*exp(2*I*e) + 20*B*a*c**4*exp(2*I*e))*exp(2*I*f*x))/(5*f*exp(10*I
*e)*exp(10*I*f*x) + 25*f*exp(8*I*e)*exp(8*I*f*x) + 50*f*exp(6*I*e)*exp(6*I*f*x) + 50*f*exp(4*I*e)*exp(4*I*f*x)
 + 25*f*exp(2*I*e)*exp(2*I*f*x) + 5*f)

Maxima [A] (verification not implemented)

none

Time = 0.32 (sec) , antiderivative size = 95, normalized size of antiderivative = 1.61 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^4 \, dx=-\frac {-4 i \, B a c^{4} \tan \left (f x + e\right )^{5} + 5 \, {\left (-i \, A + 3 \, B\right )} a c^{4} \tan \left (f x + e\right )^{4} + 20 \, {\left (A + i \, B\right )} a c^{4} \tan \left (f x + e\right )^{3} + 10 \, {\left (3 i \, A - B\right )} a c^{4} \tan \left (f x + e\right )^{2} - 20 \, A a c^{4} \tan \left (f x + e\right )}{20 \, f} \]

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^4,x, algorithm="maxima")

[Out]

-1/20*(-4*I*B*a*c^4*tan(f*x + e)^5 + 5*(-I*A + 3*B)*a*c^4*tan(f*x + e)^4 + 20*(A + I*B)*a*c^4*tan(f*x + e)^3 +
 10*(3*I*A - B)*a*c^4*tan(f*x + e)^2 - 20*A*a*c^4*tan(f*x + e))/f

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 112 vs. \(2 (49) = 98\).

Time = 0.68 (sec) , antiderivative size = 112, normalized size of antiderivative = 1.90 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^4 \, dx=-\frac {4 \, {\left (-5 i \, A a c^{4} e^{\left (2 i \, f x + 2 i \, e\right )} - 5 \, B a c^{4} e^{\left (2 i \, f x + 2 i \, e\right )} - 5 i \, A a c^{4} + 3 \, B a c^{4}\right )}}{5 \, {\left (f e^{\left (10 i \, f x + 10 i \, e\right )} + 5 \, f e^{\left (8 i \, f x + 8 i \, e\right )} + 10 \, f e^{\left (6 i \, f x + 6 i \, e\right )} + 10 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 5 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \]

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^4,x, algorithm="giac")

[Out]

-4/5*(-5*I*A*a*c^4*e^(2*I*f*x + 2*I*e) - 5*B*a*c^4*e^(2*I*f*x + 2*I*e) - 5*I*A*a*c^4 + 3*B*a*c^4)/(f*e^(10*I*f
*x + 10*I*e) + 5*f*e^(8*I*f*x + 8*I*e) + 10*f*e^(6*I*f*x + 6*I*e) + 10*f*e^(4*I*f*x + 4*I*e) + 5*f*e^(2*I*f*x
+ 2*I*e) + f)

Mupad [B] (verification not implemented)

Time = 9.16 (sec) , antiderivative size = 100, normalized size of antiderivative = 1.69 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^4 \, dx=\frac {\frac {1{}\mathrm {i}\,B\,a\,c^4\,{\mathrm {tan}\left (e+f\,x\right )}^5}{5}+\frac {1{}\mathrm {i}\,a\,\left (A+B\,3{}\mathrm {i}\right )\,c^4\,{\mathrm {tan}\left (e+f\,x\right )}^4}{4}+1{}\mathrm {i}\,a\,\left (-B+A\,1{}\mathrm {i}\right )\,c^4\,{\mathrm {tan}\left (e+f\,x\right )}^3-\frac {1{}\mathrm {i}\,a\,\left (3\,A+B\,1{}\mathrm {i}\right )\,c^4\,{\mathrm {tan}\left (e+f\,x\right )}^2}{2}+A\,a\,c^4\,\mathrm {tan}\left (e+f\,x\right )}{f} \]

[In]

int((A + B*tan(e + f*x))*(a + a*tan(e + f*x)*1i)*(c - c*tan(e + f*x)*1i)^4,x)

[Out]

(A*a*c^4*tan(e + f*x) + (a*c^4*tan(e + f*x)^4*(A + B*3i)*1i)/4 + (B*a*c^4*tan(e + f*x)^5*1i)/5 + a*c^4*tan(e +
 f*x)^3*(A*1i - B)*1i - (a*c^4*tan(e + f*x)^2*(3*A + B*1i)*1i)/2)/f